<?php

/**
 * Propiedad form base class.
 *
 * @method Propiedad getObject() Returns the current form's model object
 *
 * @package    inmobiliaria
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePropiedadForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                => new sfWidgetFormInputHidden(),
      'direccion'         => new sfWidgetFormInputText(),
      'perfil_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Perfil'), 'add_empty' => false)),
      'precio'            => new sfWidgetFormInputText(),
      'zona_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Zona'), 'add_empty' => false)),
      'descripcion'       => new sfWidgetFormTextarea(),
      'tipo_propiedad_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TipoPropiedad'), 'add_empty' => false)),
      'tipo_operacion_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TipoOperacion'), 'add_empty' => false)),
      'created_at'        => new sfWidgetFormDateTime(),
      'updated_at'        => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'direccion'         => new sfValidatorString(array('max_length' => 255)),
      'perfil_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Perfil'))),
      'precio'            => new sfValidatorInteger(),
      'zona_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Zona'))),
      'descripcion'       => new sfValidatorString(array('max_length' => 4000)),
      'tipo_propiedad_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('TipoPropiedad'))),
      'tipo_operacion_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('TipoOperacion'))),
      'created_at'        => new sfValidatorDateTime(),
      'updated_at'        => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('propiedad[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Propiedad';
  }

}
